<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
	<title>Pitest statistics</title>
</head>
<style>
@font-face {  
	font-family: 'official';  
	src: url('../../resources/fonts/Caveman.ttf');  
}

a{
	text-decoration: none;
	color: blue;
}

#title{
	background: black;
	color: white;
	font-size: 30px;
	padding: 40px 0 10px;
	text-align: center;
	text-shadow: 0 0 4px white, 0 -5px 4px #ff3, 2px -10px 6px #fd3, -2px -15px 11px #f80, 2px -25px 18px #f20;
	font-size: 40px;
	-moz-box-shadow: 10px 10px 5px #888;
	-webkit-box-shadow: 10px 10px 5px #888;
	box-shadow: 10px 10px 5px #888;
	}	
.header{
	font-family: official; 
	font-size: 30px;
}

#packagesHeader{
	margin-top: 20px;
}

#packages, #classes{
	margin: 20px;
}


.table th{
	padding: 0 10px 0 10px;
}

.table td{
	padding: 5px 10px 5px 10px;
	border: 1px solid black;
	text-align: center;
}

#currentPackage{
	margin-bottom: 30px;
	font-size: 20px;
	background-color: black;
	padding: 20px;
	color:white;
	-moz-box-shadow: 10px 10px 5px #888;
	-webkit-box-shadow: 10px 10px 5px #888;
	box-shadow: 10px 10px 5px #888;	
}

</style>
<body>

<div id="title">
	PITEST-STATISTICS
</div>

<c:if test="${not empty currentPackage}">
	 <div id="currentPackage">
	 	${currentPackage.name}
	 </div>
</c:if>

<c:if test="${not empty packageStatistics}">

	<div class="header" id="packagesHeader">
		Packages
	</div>
	<table class="table" id="packages" >
		<tr>
			<th>Package Name</th>
			<th>Mutation Coverage</th>
			<th></th>
		</tr>
	
	<c:forEach items="${packageStatistics}" var="statistic">
		<fmt:formatNumber var="colorGreen" value="${(statistic.mutationCoverage/100)*256}" pattern="#"/>
	
        <c:set var="colorRed" value="${256-colorGreen}"/>
		
		<tr style="background: rgba(${colorRed}, ${colorGreen}, 0, .25);  ">
			<td>${statistic.packageInfo.name}</td>
			<td>${statistic.mutationCoverage}</td>
			<td class="packageDetails"> 
				<a href="statistics?packageId=${statistic.packageInfo.id}">Details</a>
			</td>
		</tr>
	</c:forEach>
	</table>
</c:if>


<c:if test="${not empty packageClasses}">
	<div class="header">
		Classes
	</div>
	
	<table class="table" id="classes" >
		<tr>
			<th>Class Name</th>
			<th>Mutation Coverage</th>
			<th></th>
		</tr>
	
	<c:forEach items="${packageClasses}" var="packageClass">
		<fmt:formatNumber var="colorGreen" value="${(packageClass.mutationCoverage/100)*256}" pattern="#"/>
        <c:set var="colorRed" value="${256-colorGreen}"/>
	
		<tr style="background: rgba(${colorRed}, ${colorGreen}, 0, .25);  ">
			<td>${packageClass.className}</td>
			<td>${packageClass.mutationCoverage}</td>
		</tr>
	
	</c:forEach>
	
	</table>
</c:if>

</body>
</html>